package com.sayyi.validate.domain;

import com.sayyi.validate.constraints.custom.Exist;
import com.sayyi.validate.constraints.custom.NotExist;
import lombok.Builder;
import lombok.Data;

import javax.validation.constraints.*;

/**
 * 订单详情导入实体
 * @author xuchuang
 * date 2021/11/29 5:11 下午
 */
@Data
@Builder
public class OrderDetail {

    /** 车架号**/
    @NotNull(message = "车间号不能改为空")
    @Size(min = 17, max = 17, message = "车架号长度只能为{min}位")
    @NotExist(value = "import-vins", message = "车架号[${validatedValue}]已经存在于第[${cachedValue}]行")
    @NotExist(value = "db-vins", message = "车架号[${validatedValue}]已经存在于订单[${cachedValue}]中")
    private String vin;

    /** 车辆品牌**/
    @NotNull(message = "车辆品牌不能为空")
    @Size(max = 50, message = "车辆品牌最多为{max}位")
    private String carBrand;

    /** 车辆型号**/
    @NotNull(message = "车辆型号不能为空")
    @Size(max = 50, message = "车辆型号最多为{max}位")
    private String carType;

    /** 车辆名称**/
    @NotNull(message = "车辆名称不能为空")
    @Size(max = 50, message = "车辆名称最多为{max}位")
    private String carName;

    /** 公告号**/
    @NotNull(message = "公告号不能为空")
    @Size(max = 20, message = "公告号最多为{max}位")
    private String notificationNo;

    /** 采购含税单价**/
    @NotNull(message = "采购含税单价不能为空")
    @Digits(integer = 10, fraction = 2, message = "采购含税单价最多{fraction}位小数")
    @DecimalMin(value = "0", message = "采购含税单价最小为{value}")
    @DecimalMax(value = "500000", message = "采购含税单价最大为{value}")
    private String purchasePrice;

    /** 销售含税单价**/
    @NotNull(message = "销售含税单价不能为空")
    @Digits(integer = 10, fraction = 2, message = "销售含税单价最多{fraction}位小数")
    @DecimalMin(value = "0", message = "销售含税单价最小为{value}")
    @DecimalMax(value = "500000", message = "销售含税单价最大为{value}")
    private String sellPrice;

    /** 里程保证金**/
    @Size(max = 20, message = "里程保证金最多为{max}位")
    private String guaranteedPrice;

    /** 首付款**/
    @Digits(integer = 10, fraction = 2, message = "首付款最多{fraction}位小数")
    @DecimalMin(value = "0", message = "首付款最小为{value}")
    @DecimalMax(value = "99990000", message = "首付款最大为{value}")
    private String downPayment;

    /** 尾款**/
    @Digits(integer = 10, fraction = 2, message = "尾款最多{fraction}位小数")
    @DecimalMin(value = "0", message = "尾款最小为{value}")
    @DecimalMax(value = "99990000", message = "尾款最大为{value}")
    private String finalPayment;

    /** 其他服务费**/
    @Size(max = 20, message = "其他服务费最多为{max}位")
    private String otherPayment;

    /** 交期约定**/
    @Size(max = 50, message = "交期约定最多为{max}位")
    private String deliveryAgreement;

    /** 业务类型 */
    @Exist(value = "business-type", message = "未知的业务类型")
    private String businessTypeName;

}
